<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateLayoutAreasTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('layout_areas', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('layout_id')->unsigned()->comment('布局ID');
            $table->string('name')->nullable()->comment('区位名称');
            $table->integer('data_type')->unsigned()->default(0)->nullable()->comment('数据类型');
            $table->integer('data_id')->unsigned()->default(0)->nullable()->comment('数据内容');

            // $table->foreign('layout_id')->references('id')->on('layouts')->onDelete('cascade');

            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('layout_areas');
    }
}
